<!DOCTYPE html>
<html lang="zh-CN" xmlns="http://www.w3.org/1999/xhtml"
      xmlns:th="http://www.thymeleaf.org">
<head th:include="/common/inc::header"/>
<body>

<form class="layui-form" style="margin-left: 10%" id="infoForm">
    <br/>
    <div class="layui-form-item">
        <label class="layui-form-label">代理商:</label>
        <div class="layui-input-block">
            <input type="text" name="username" id="username" lay-verify="required"
                   style="width: 300px" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">地区:</label>
        <div class="layui-input-block">
            <input type="text" name="area" id="area" lay-verify="required"
                   style="width: 300px" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">推广码:</label>
        <div class="layui-input-inline">
            <button type="button" class="layui-btn layui-btn-danger j-qrcode">生成推广码</button>
        </div>
    </div>
</form>

<script th:replace="/common/inc::incJs"></script>
<script>
    $(function () {
        var form = layui.form;
        var bdId = null;
        $.getJSON('/agent/security/bdTeam/detail', function (res) {
            if (res.code < 0) {
                layer.msg(res.message);
            }
            else {
                var data = res.body;
                bdId = data.id;
                $("#infoForm").loadData(res.body);
            }
        });

        $(".j-qrcode").click(function () {
            $.getJSON("/agent/security/bdTeam/getMinaQr", {bdId: bdId}, function (res) {
                if (res.code < 0) {
                    layer.msg(res.message);
                }
                else {
                    window.open(res.body, "newwindow", "height=800, width=800, top =100, left=500, toolbar=no, menubar=no, scrollbars =no, location=no");
                }
            })
        })
    })


</script>
</body>
</html>
